// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout, FixedLayout, FixedLayoutShare, FixedLayoutNoFooter } from '@/layouts'
// eslint-disable-next-line
const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/console',
    name: 'console',
    component: FixedLayoutNoFooter,
    meta: { title: 'menu.console' },
    redirect: '/console/gpu-cloud-serve',
    children: [
      {
        path: '/console',
        redirect: '/console/gpu-cloud-serve',
        component: () => import('@/views/Console/index.vue'),
        meta: { title: '控制台' },
        children: [
          {
            path: '/console/gpu-cloud-serve',
            name: 'console/gpu-cloud-serve',
            component: () => import('@/views/Console/GpuCloudServe.vue'),
            meta: { title: 'GPU云服务器', keepAlive: true }
          },
          {
            path: '/console/public-cloud-serve',
            name: 'console/public-cloud-serve',
            component: () => import('@/views/Console/PublicCloudServe.vue'),
            meta: { title: '通用云服务器', keepAlive: true }
          },
          {
            path: '/console/ip-serve',
            name: 'console/ip-serve',
            component: () => import('@/views/Console/IPServe.vue'),
            meta: { title: '弹性公网IP', keepAlive: true }
          },
          {
            path: '/console/security',
            name: 'console/security',
            component: () => import('@/views/Console/Security.vue'),
            meta: { title: '安全', keepAlive: true }
          },
          {
            path: '/console/gpu-detail',
            name: 'console/gpu-detail',
            component: () => import('@/views/Console/GpuCloudServeDetail.vue'),
            meta: { title: '服务器详情', keepAlive: true }
          }
        ]
      }
    ]
  },
  {
    path: '/account',
    name: 'account',
    component: FixedLayoutNoFooter,
    meta: { title: 'menu.account' },
    redirect: '/account',
    children: [
      {
        path: '/account',
        redirect: '/account/home',
        component: () => import('@/views/Account/Index.vue'),
        meta: { title: '用户中心' },
        children: [
          {
            path: '/account/home',
            name: 'account/home',
            component: () => import('@/views/Account/Home.vue'),
            meta: { title: '首页', keepAlive: true }
          },
          {
            path: '/account/fund',
            name: 'account/fund',
            component: () => import('@/views/Account/Fund.vue'),
            meta: { title: '资金管理', keepAlive: true }
          },
          {
            path: '/account/order',
            name: 'account/order',
            component: () => import('@/views/Account/Order.vue'),
            meta: { title: '订单管理', keepAlive: true }
          },
          {
            path: '/account/consumptive-volume',
            name: 'account/consumptiveVolume',
            component: () => import('@/views/Account/ConsumptiveVolume.vue'),
            meta: { title: '卡券管理', keepAlive: true }
          },
          {
            path: '/account/bill',
            name: 'account/bill',
            component: () => import('@/views/Account/Bill.vue'),
            meta: { title: '账单管理', keepAlive: true }
          },
          {
            path: '/account/base-setting',
            name: 'account/baseSetting',
            component: () => import('@/views/Account/BaseSetting.vue'),
            meta: { title: '账号管理', keepAlive: true }
          },
          {
            path: '/account/community',
            name: 'account/community',
            component: () => import('@/views/Account/Community/Index.vue'),
            meta: { title: '我的圈子', keepAlive: true }
          }
        ]
      }
    ]
  },
  {
    path: '/product',
    name: 'product',
    component: FixedLayoutNoFooter,
    meta: { title: 'menu.product' },
    redirect: '/product',
    children: [
      {
        path: '/product',
        redirect: '/product/cloud-server',
        component: RouteView,
        meta: { title: '产品中心' },
        children: [
          {
            path: '/product/cloud-server',
            name: 'product/cloud-server',
            component: () => import('@/views/Product/CloudServer.vue'),
            meta: { title: 'GPU云服务器', keepAlive: true }
          },
          {
            path: '/product/public-server',
            name: 'product/public-server',
            component: () => import('@/views/Product/PublicServerBug.vue'),
            meta: { title: '通用云服务器', keepAlive: true }
          }
        ]
      }
    ]
  },
  {
    path: '/renew',
    name: 'Renew',
    component: FixedLayoutNoFooter,
    meta: { title: '续费' },
    redirect: '/renew'
  },
  //     // // Exception
  //     // {
  //     //   path: '/exception',
  //     //   name: 'exception',
  //     //   component: RouteView,
  //     //   redirect: '/exception/403',
  //     //   meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
  //     //   children: [
  //     //     {
  //     //       path: '/exception/403',
  //     //       name: 'Exception403',
  //     //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
  //     //       meta: { title: '403', permission: [ 'exception' ] }
  //     //     },
  //     //     {
  //     //       path: '/exception/404',
  //     //       name: 'Exception404',
  //     //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
  //     //       meta: { title: '404', permission: [ 'exception' ] }
  //     //     },
  //     //     {
  //     //       path: '/exception/500',
  //     //       name: 'Exception500',
  //     //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
  //     //       meta: { title: '500', permission: [ 'exception' ] }
  //     //     }
  //     //   ]
  //     // },
  //   ]
  // },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/',
    component: FixedLayout,
    redirect: '/home',
    hidden: true,
    children: [
      {
        path: '/home',
        name: 'home',
        meta: { title: '资源与服务', keepAlive: true },
        component: () => import('@/views/Home.vue'),
        childRouter: [
          { path: '/home/a', title: '通用算力' },
          { path: '/home/b', title: 'AI算力' },
          { path: '/home/c', title: '云存储' },
          { path: '/home/d', title: '智能编程框架' },
          { path: '/home/e', title: '高性能算力' },
          { path: '/home/f', title: '专有网络' }
        ]
      },
      {
        path: '/app',
        name: 'app',
        meta: { title: '应用切片', keepAlive: true },
        component: () => import('@/views/App.vue')
      },
      {
        path: '/news',
        name: 'news',
        meta: { title: '动态新闻', keepAlive: true },
        component: () => import('@/views/News.vue')
      },
      {
        path: '/help',
        name: 'help',
        meta: { title: '支持与帮助', keepAlive: true },
        component: () => import('@/views/Help.vue')
      },
      {
        path: '/community',
        name: 'community',
        meta: { title: '圈子', keepAlive: true },
        component: () => import('@/views/Community.vue')
      },
      {
        path: '/about',
        name: 'about',
        meta: { title: '关于我们', keepAlive: true },
        component: () => import('@/views/About.vue')
      }
    ]
  },
  {
    path: '/user',
    component: FixedLayoutShare,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        meta: { title: '登录', keepAlive: true },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/LoginNew')
      },
      {
        path: 'register',
        name: 'register',
        meta: { title: '注册', keepAlive: true },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterNew')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        meta: { title: '注册', keepAlive: true },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },

      {
        path: 'forget-password',
        name: 'forgetPassword',
        meta: { title: '找回密码', keepAlive: true },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/ForgetPassword')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },
  {
    path: '/detail',
    component: FixedLayout,
    redirect: '/detail/cloud-detail',
    hidden: true,
    children: [
      {
        path: 'cloud-detail',
        meta: { title: '详情', keepAlive: true },
        name: 'cloud-detail',
        component: () => import('@/views/Product/CloudDetail.vue')
      },
      {
        path: 'ip-detail',
        meta: { title: '详情', keepAlive: true },
        name: 'ip-detail',
        component: () => import('@/views/Product/IPDetail.vue')
      },
      {
        path: 'public-serve',
        meta: { title: '详情', keepAlive: true },
        name: 'public-serve',
        component: () => import('@/views/Product/PublicServe.vue')
      }
    ]
  },
  {
    path:'/lab',
    component:()=>import('@/views/Lab.vue'),
    redirect:'/lab/source',
    children:[{
      path:'source',
      component:()=>import('@/views/Lab/Source')
    },{
      path:'add',
      component:()=>import('@/views/Lab/AddSource')
    }]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
